function output = FC_Property_Setup(mws, Frq, SovlerType)
    %myFun - Description
    %
    % Syntax: output = myFun(input)
    %
    % Long description

    if ~exist('SovlerType', 'var') || isempty(SovlerType)
        % 没有定义则使用频率求解器
        SovlerType = 'frequency';
    elseif lower(SovlerType) ~= "time" && lower(SovlerType) ~= "frequency"
        disp(['输入求解器类型错误！'])
    end

    %% 单位格式设置
    CMDs = '';
    CMDs = [CMDs 'With Units'];
    CMDs = [CMDs 10 '    .Geometry "um"'];
    CMDs = [CMDs 10 '    .Frequency "THz"'];
    CMDs = [CMDs 10 '    .Voltage "V"'];
    % CMDs = [CMDs 10 '    .Resistance "Ohm"'];
    % CMDs = [CMDs 10 '    .Inductance "H"'];
    % CMDs = [CMDs 10 '    .Current "A"'];
    % CMDs = [CMDs 10 '    .Conductance "Siemens"'];
    % CMDs = [CMDs 10 '    .Capacitance "F"'];
    CMDs = [CMDs 10 '    .Time "ps"'];
    % CMDs = [CMDs 10 '    .TemperatureUnit "kelvin"'];
    CMDs = [CMDs 10 'End With'];
    invoke(mws, 'AddToHistory', '设置单位', CMDs);

    %% 频率范围设置
    CMDs = '';
    CMDs = [CMDs 'Solver.FrequencyRange ' num2str(Frq(1)), ', ' num2str(Frq(2))];
    invoke(mws, 'AddToHistory', '设置频率范围', CMDs);

    %% 背景设置
    CMDs = '';
    CMDs = [CMDs 'With Background'];
    CMDs = [CMDs 10 '        .Type "Normal"'];
    % CMDs = [CMDs 10 '        .Epsilon "1.0"'];
    % CMDs = [CMDs 10 '        .Mu "1.0"'];
    % CMDs = [CMDs 10 '        .Rho "1.204"'];
    % CMDs = [CMDs 10 '        .ThermalType "Normal"'];
    % CMDs = [CMDs 10 '        .ThermalConductivity "0.026"'];
    % CMDs = [CMDs 10 '        .HeatCapacity "1.005"'];
    % CMDs = [CMDs 10 '        .XminSpace "0.0"'];
    % CMDs = [CMDs 10 '        .XmaxSpace "0.0"'];
    % CMDs = [CMDs 10 '        .YminSpace "0.0"'];
    % CMDs = [CMDs 10 '        .YmaxSpace "0.0"'];
    % CMDs = [CMDs 10 '        .ZminSpace "0.0"'];
    % CMDs = [CMDs 10 '        .ZmaxSpace "0.0"'];
    CMDs = [CMDs 10 'End With'];
    invoke(mws, 'AddToHistory', '设置背景', CMDs);

    if lower(SovlerType) == "frequency"
        %% 设置源和边界
        CMDs = '';
        CMDs = [CMDs 10 'With FloquetPort'];
        CMDs = [CMDs 10 '    .Reset'];
        CMDs = [CMDs 10 '    .SetDialogTheta "0"'];
        CMDs = [CMDs 10 '    .SetDialogPhi "0"'];
        CMDs = [CMDs 10 '    .SetSortCode "+beta/pw"'];
        CMDs = [CMDs 10 '    .SetCustomizedListFlag "False"'];
        CMDs = [CMDs 10 '    .Port "Zmin"'];
        CMDs = [CMDs 10 '    .SetNumberOfModesConsidered "2"'];
        CMDs = [CMDs 10 '    .Port "Zmax"'];
        CMDs = [CMDs 10 '    .SetNumberOfModesConsidered "2"'];
        CMDs = [CMDs 10 'End With'];

        CMDs = [CMDs 10 'MakeSureParameterExists "theta", "0"'];
        CMDs = [CMDs 10 'SetParameterDescription "theta", "spherical angle of incident plane wave"'];
        CMDs = [CMDs 10 'MakeSureParameterExists "phi", "0"'];
        CMDs = [CMDs 10 'SetParameterDescription "phi", "spherical angle of incident plane wave"'];
        CMDs = [CMDs 10 'With Boundary'];
        CMDs = [CMDs 10 '    .Xmin "unit cell"'];
        CMDs = [CMDs 10 '    .Xmax "unit cell"'];
        CMDs = [CMDs 10 '    .Ymin "unit cell"'];
        CMDs = [CMDs 10 '    .Ymax "unit cell"'];
        CMDs = [CMDs 10 '    .Zmin "electric"'];
        CMDs = [CMDs 10 '    .Zmax "expanded open"'];
        CMDs = [CMDs 10 '    .Xsymmetry "none"'];
        CMDs = [CMDs 10 '    .Ysymmetry "none"'];
        CMDs = [CMDs 10 '    .Zsymmetry "none"'];
        CMDs = [CMDs 10 '    .XPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '    .YPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '    .ZPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '    .PeriodicUseConstantAngles "False"'];
        CMDs = [CMDs 10 '    .SetPeriodicBoundaryAngles "theta", "phi"'];
        CMDs = [CMDs 10 '    .SetPeriodicBoundaryAnglesDirection "inward"'];
        CMDs = [CMDs 10 '    .UnitCellFitToBoundingBox "True"'];
        CMDs = [CMDs 10 '    .UnitCellDs1 "0.0"'];
        CMDs = [CMDs 10 '    .UnitCellDs2 "0.0"'];
        CMDs = [CMDs 10 '    .UnitCellAngle "90.0"'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '设置激励和边界条件', CMDs);

        %% 设置网格1
        CMDs = '';
        CMDs = [CMDs 'With Mesh'];
        CMDs = [CMDs 10 '  .MeshType "Tetrahedral"'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '设置网格', CMDs);

        %% 设置求解器
        CMDs = '';
        CMDs = [CMDs 'With FDSolver'];
        CMDs = [CMDs 10 ' .Reset'];
        CMDs = [CMDs 10 ' .Stimulation "Zmax", "All"'];
        % CMDs = [CMDs 10 ' .Stimulation "List", "List"'];
        CMDs = [CMDs 10 ' .ResetExcitationList'];
        CMDs = [CMDs 10 ' .AddToExcitationList "Zmax", "TE(0,0);TM(0,0)"'];
        CMDs = [CMDs 10 ' .LowFrequencyStabilization "False"'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '设置求解器', CMDs);

        %% 设置网格2
        CMDs = '';
        CMDs = [CMDs 'With Mesh'];
        CMDs = [CMDs 10 '  .MeshType "Tetrahedral"'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '设置网格2-2', CMDs);
        %% 再次设置求解器类型
        CMDs = '';
        CMDs = [CMDs 'With Mesh'];
        CMDs = [CMDs 10 '  ChangeSolverType("HF Frequency Domain")'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '切换求解器', CMDs);

    elseif lower(SovlerType) == "time"
        % 定义求解器类型
        disp(['选择的是时域求解器'])
        CMDs = '';
        CMDs = [CMDs '  ChangeSolverType("HF Time Domain")'];
        invoke(mws, 'AddToHistory', '更改求解器类型', CMDs);
        % 定义求解器参数及网格类型

        CMDs = '';
        CMDs = [CMDs 'Mesh.SetCreator "High Frequency"'];
        CMDs = [CMDs 10 'With Solver'];
        CMDs = [CMDs 10 '.Method "Hexahedral TLM"'];
        CMDs = [CMDs 10 '.SteadyStateLimit "-40"'];
        CMDs = [CMDs 10 '.StimulationPort "All"'];
        CMDs = [CMDs 10 '.StimulationMode "All"'];
        CMDs = [CMDs 10 '.AutoNormImpedance "False"'];
        CMDs = [CMDs 10 '.NormingImpedance "50"'];
        CMDs = [CMDs 10 '.StoreTDResultsInCache "False"'];
        CMDs = [CMDs 10 '.SuperimposePLWExcitation "False"'];
        CMDs = [CMDs 10 '.SParaSymmetry "False"'];
        CMDs = [CMDs 10 'End With'];
        % 定义周期边界
        CMDs = '';
        CMDs = [CMDs 'With Boundary'];
        CMDs = [CMDs 10 'MakeSureParameterExists "theta", "0"'];
        CMDs = [CMDs 10 'MakeSureParameterExists "phi", "0"'];
        CMDs = [CMDs 10 '.Xmin "periodic"'];
        CMDs = [CMDs 10 '.Xmax "periodic"'];
        CMDs = [CMDs 10 '.Ymin "periodic"'];
        CMDs = [CMDs 10 '.Ymax "periodic"'];
        CMDs = [CMDs 10 '.Zmin "electric"'];
        CMDs = [CMDs 10 '.Zmax "expanded open"'];
        CMDs = [CMDs 10 '.Xsymmetry "none"'];
        CMDs = [CMDs 10 '.Ysymmetry "none"'];
        CMDs = [CMDs 10 '.Zsymmetry "none"'];
        CMDs = [CMDs 10 '.ApplyInAllDirections "False"'];
        CMDs = [CMDs 10 '.XPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '.YPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '.ZPeriodicShift "0.0"'];
        CMDs = [CMDs 10 '.PeriodicUseConstantAngles "True"'];
        CMDs = [CMDs 10 '.SetPeriodicBoundaryAngles "theta", "phi"'];
        CMDs = [CMDs 10 '.SetPeriodicBoundaryAnglesDirection "inward"'];
        CMDs = [CMDs 10 'End With'];
        invoke(mws, 'AddToHistory', '定义周期边界', CMDs);
        % 定义端口

    end

    %% 定义材料
    Lib_Material;
    % 2. 材料1 Gold设置

    invoke(mws, 'AddToHistory', '定义金', Gold_YW);
    % 3. 材料2 HTL_YW 设置

    invoke(mws, 'AddToHistory', '定义HTL', HTL_YW);
    invoke(mws, 'AddToHistory', '定义bio', BIO_YW);
    % 4. 材料3 Cu_YW 设置

    invoke(mws, 'AddToHistory', '定义Cu', Cu_YW);

    invoke(mws, 'AddToHistory', '不显示工作平面', 'Plot.DrawWorkplane "false"');

end
